/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.click.app.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 *
 * @author ariel
 */
@Entity
@Table(name = "asignation_pant_pays")
public class AsignationPantPay extends BaseObject{

    private static final long serialVersionUID = 1L;
    
    private Long id;
    private Double amountPayed;
    private ProcessDressmaker processDressmaker;
    private PaymentsPant paymentsPant;

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE)
    @Column(name="id_asignation_pant_pay", unique=true, nullable=false)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Column(name = "amount_payed", precision = 6, scale = 0)
    public Double getAmountPayed() {
        return amountPayed;
    }

    public void setAmountPayed(Double amountPayed) {
        this.amountPayed = amountPayed;
    }

    @JoinColumn(name = "id_process_dressmaker", referencedColumnName = "id_process_dressmaker")
    @ManyToOne(optional = false)
    public ProcessDressmaker getProcessDressmaker() {
        return processDressmaker;
    }

    public void setProcessDressmaker(ProcessDressmaker processDressmaker) {
        this.processDressmaker = processDressmaker;
    }

    @JoinColumn(name = "id_payments_pant", referencedColumnName = "id_payments_pant")
    @ManyToOne(optional = false)
    public PaymentsPant getPaymentsPant() {
        return paymentsPant;
    }

    public void setPaymentsPant(PaymentsPant paymentsPant) {
        this.paymentsPant = paymentsPant;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (getId() != null ? getId().hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AsignationPantPay)) {
            return false;
        }
        AsignationPantPay other = (AsignationPantPay) object;
        if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.click.app.model.AsignationPant[id=" + getId() + "]";
    }

}
